/// <reference types="vitest" />

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import svgr from 'vite-plugin-svgr'
import path from 'path'
import env from './src/env.config'

// https://vite.dev/config/
export default defineConfig({
  plugins: [react(), svgr()],
  test: {
    environment: 'jsdom',
    coverage: {
      provider: 'istanbul',
    }
  },
  base: env.fileBaseUrl,
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src'),
      extensions: 'tsx'
    }
  },
  server: {
    ...env.serverConfig,
    open: 'http://127.0.0.1:9070/#/'
  },
  build: {
    outDir: './static'
  },
  css: {
    preprocessorOptions: {
      less: {
        javascriptEnabled: true,
        additionalData: `@import "${path.resolve(__dirname, './src/styles/global-style.less')}";`,
      }
    }
  }
})
